home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / asm32.zip / E32.ZIP / TOPLINE.ASM < prev    next >
Assembly Source File  |  1996-01-05  |  2KB  |  116 lines

  1. ; TOPLINE.ASM for E32 - Copyright (C) 1994 Douglas Herr
  2. ;  all rights reserved
  3.  
  4. ; prints file information on top line of screen:
  5. ;
  6. ;  filename
  7. ;  cursor row
  8. ;  cursor column
  9.  
  10. include    model.inc
  11.  
  12. public    topline, showpos, saved_pos
  13. extrn    i4tostr:near
  14. extrn    tputchr:near
  15. extrn    tprintce:near
  16. extrn    tprint:near
  17. extrn    dwordtohex:near
  18.  
  19. include    dataseg.inc
  20. extrn    no_file_name:byte
  21. extrn    filesiz:dword        ; bytes in buffer (NOT buffer size)
  22. extrn    filename:dword        ; ptr to filename
  23. extrn    file_row:dword
  24. extrn    inverse:byte
  25. extrn    cur_posn:word
  26. extrn    left_margin:word
  27. extrn    columns:byte
  28. extrn    dirty_bits:byte
  29. extrn    first_row:byte
  30. extrn    cursor:dword
  31. extrn    display_mode:byte
  32.  
  33. saved_pos    dd 0FFFFh
  34. pos_proc    dd _ascii
  35.         dd _hex
  36. @curseg    ends
  37.  
  38. include    codeseg.inc
  39. topline    proc    near
  40.     test    dirty_bits,00100000b    ; name change?
  41.     jz    short showpos
  42.  
  43.     mov    esi,filename
  44.     cmp    byte ptr [esi],0
  45.     jne    short got_file_name
  46.     lea    esi,no_file_name
  47.  
  48. got_file_name:
  49.     mov    ah,inverse
  50.     xor    dx,dx
  51.     mov    dh,first_row
  52.     dec    dh
  53.     mov    al,' '
  54.     call    tputchr
  55.     inc    dl
  56.     call    tprintce
  57.     mov    saved_pos,0FFFFFFFFh
  58.     and    dirty_bits,11011111b
  59. topline    endp
  60.  
  61. number_buffer    equ    [ebp-12]
  62.  
  63. showpos    proc    near
  64.     enter    12,0
  65.     lea    esi,number_buffer
  66.     mov    eax,cursor
  67.     mov    dh,first_row
  68.     mov    dl,columns
  69.     dec    dh
  70.  
  71.     movzx    ecx,display_mode
  72.     jmp    pos_proc[ecx]
  73.  
  74. _hex:
  75. ; EAX = cursor
  76.     call    dwordtohex
  77.     sub    dl,9
  78.     mov    ah,inverse
  79.     call    tprint
  80.     leave
  81.     ret
  82.  
  83. _ascii:
  84.     cmp    eax,saved_pos
  85.     mov    saved_pos,eax
  86.     je    short exit
  87.     movzx    eax,byte ptr cur_posn    ; EAX = cursor column
  88.     lea    esi,number_buffer
  89.     add    ax,left_margin        ; adjust for screen shift
  90.     adc    eax,1            ; show column '0' as '1'
  91.     call    i4tostr
  92.     add    esi,6
  93.     sub    dl,5
  94.     mov    ah,inverse
  95.     call    tprint
  96.     sub    dl,2
  97.     mov    al,'C'            ; 'Column' label
  98.     call    tputchr
  99.     sub    dl,6
  100.     mov    eax,file_row
  101.     lea    esi,number_buffer
  102.     call    i4tostr
  103.     add    esi,6
  104.     mov    ah,inverse
  105.     call    tprint
  106.     sub    dl,2
  107.     mov    al,'R'            ; 'Row' label
  108.     call    tputchr
  109. exit:
  110.     leave
  111.     ret
  112. showpos    endp
  113.  
  114. @curseg    ends
  115.     end
  116.